<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>repluck</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="remove.html" title="remove" />
    <link rel="next" href="reson.html" title="reson" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">repluck</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="remove.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="reson.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="repluck"></a>
      <div class="titlepage"></div>
      <a id="IndexRepluck" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">repluck</span>
        </h2>
        <p>repluck — 
      Physical model of the plucked string.
          </p>
      </div>
      <div class="refsect1">
        <a id="idp142097056"></a>
        <h2>Description</h2>
        <p>
       <span class="emphasis"><em>repluck</em></span> is an implementation of the physical model of the plucked string. A user can control the pluck point, the pickup point, the filter, and an additional audio signal, <span class="emphasis"><em>axcite</em></span>. <span class="emphasis"><em>axcite</em></span> is used to excite the 'string'. Based on the Karplus-Strong algorithm.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp142151344"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ares <span class="command"><strong>repluck</strong></span> iplk, kamp, icps, kpick, krefl, axcite</pre>
      </div>
      <div class="refsect1">
        <a id="idp142153392"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>iplk</em></span> -- The point of pluck is <span class="emphasis"><em>iplk</em></span>, which is a fraction of the way up the string (0 to 1). A pluck point of zero means no initial pluck.
    </p>
        <p>
      <span class="emphasis"><em>icps</em></span>  -- The string plays at <span class="emphasis"><em>icps</em></span> pitch.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp142157056"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kamp</em></span> -- Amplitude of note.
    </p>
        <p>
      <span class="emphasis"><em>kpick</em></span> -- Proportion of the way along the string to sample the output.
    </p>
        <p>
      <span class="emphasis"><em>krefl</em></span> -- the coefficient of reflection, indicating the lossiness and the rate of decay. It must be strictly between 0 and 1 (it will complain about both 0 and 1).
    </p>
      </div>
      <div class="refsect1">
        <a id="idp142160912"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>axcite</em></span> -- A signal which excites the string.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp142162640"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the repluck opcode. It uses the file <a class="ulink" href="examples/repluck.csd" target="_top"><em class="citetitle">repluck.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp142164416"></a>
          <p class="title">
            <strong>Example 751. Example of the repluck opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac   <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o repluck.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100 
<span class="ohdr">ksmps</span> <span class="op">=</span> 32 
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1 
<span class="ohdr">nchnls</span> <span class="op">=</span> 2

<span class="oblock">instr</span> 1

iplk  <span class="op">=</span> 0.75
kamp  <span class="op">=</span> .8
icps  <span class="op">=</span> 110
krefl <span class="op">=</span> p4
kpick <span class="op">=</span> p5


axcite <span class="opc">oscil</span> 1, 1, 1
asig <span class="opc">repluck</span> iplk, kamp, icps, kpick, krefl, axcite
asig <span class="opc">dcblock2</span> asig		<span class="comment">;get rid of DC offset</span>
     <span class="opc">outs</span> asig, asig

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span> 1 0 16384 10 1	<span class="comment">;sine wave.</span>

<span class="stamnt">s</span>
<span class="stamnt">i</span> 1 0 1 0.95 0.75	<span class="comment">;sounds heavier (=p5)</span>
<span class="stamnt">i</span> 1 + 1  &lt;
<span class="stamnt">i</span> 1 + 1  &lt;
<span class="stamnt">i</span> 1 + 1  &lt;
<span class="stamnt">i</span> 1 + 10 0.6

<span class="stamnt">s</span>
<span class="stamnt">i</span> 1 0 1 0.95 0.15	<span class="comment">;sounds softer (=p5)</span>
<span class="stamnt">i</span> 1 + 1  &lt;
<span class="stamnt">i</span> 1 + 1  &lt;
<span class="stamnt">i</span> 1 + 1  &lt;
<span class="stamnt">i</span> 1 + 10 0.6
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp142168736"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="wgpluck2.html" title="wgpluck2"><em class="citetitle">wgpluck2</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp142170848"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: John ffitch</td>
          </tr>
          <tr>
            <td>University of Bath/Codemist Ltd.</td>
          </tr>
          <tr>
            <td>Bath, UK</td>
          </tr>
          <tr>
            <td>1997</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in version 3.47</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="remove.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="reson.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">remove </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> reson</td>
        </tr>
      </table>
    </div>
  </body>
</html>
